<template>
  <el-form
      :model="registerForm"
      label-width="120px"
      class="register-form"
  >
    <h2>用户注册</h2>

    <el-form-item label="用户名" prop="yhm">
      <el-input
          v-model="registerForm.yhm"
          placeholder="请输入用户名"
          clearable
      />
    </el-form-item>

    <el-form-item label="密码" prop="pwd">
      <el-input
          v-model="registerForm.pwd"
          type="password"
          placeholder="请输入密码"
          show-password
      />
    </el-form-item>

    <el-form-item label="确认密码" prop="checkpwd">
      <el-input
          v-model="registerForm.checkpwd"
          type="password"
          placeholder="请再次输入密码"
          show-password
      />
    </el-form-item>

    <el-form-item label="邮箱" prop="email">
      <el-input
          v-model="registerForm.email"
          placeholder="请输入邮箱"
          clearable
      />
    </el-form-item>

    <el-form-item label="手机号" prop="phone">
      <el-input
          v-model="registerForm.phone"
          placeholder="请输入手机号"
          clearable
      />
    </el-form-item>


    <el-form-item>
      <el-button
          type="primary"
          @click="doSign"
      >
        立即注册
      </el-button>
      <el-button @click="">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import { ref, reactive } from 'vue'
import { ElMessage } from 'element-plus'

// 表单数据
const registerForm = reactive({
  yhm: '',
  pwd: '',
  phone: '',
  email: '',
  sex: '',
  tx:'',
  checkpwd: ''

})
const doSign = () => {
  if (!registerForm.value.yhm || !registerForm.value.pwd) {
    ElMessage.error('请输入用户名和密码')
    return
  }

}

</script>

<style scoped>
.register-form {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

h2 {
  text-align: center;
  margin-bottom: 20px;
  color: #409EFF;
}
</style>